package me.edzh.spring.bootstrap.utils.security;

import com.yhb.utils.SignConfig;

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.util.Base64;

public class SignUtils {
    public static void main(String[] args) throws Throwable {
        System.out.println(new SignConfig().sign("fuck=heiheiehi&timeStamp=1570189805661&zed=322").toUpperCase());
        System.out.println(generateKey());
    }

    public static String generateKey() throws Throwable {
        KeyGenerator keyGenerator = KeyGenerator.getInstance("HmacSHA256");
        SecretKey secretKey = keyGenerator.generateKey();
        return Base64.getEncoder().encodeToString(secretKey.getEncoded());
    }
}
